<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // var outerValue = 'ninja';
    // +function outerFunction(){
    //   console.log(outerValue === 'ninja');
    // }()

    //模拟私有变量
    function Ninja() {
      var feints = 0;
      this.getCount = function () {
        return feints;
      }
      this.feint = function () {
        feints++;
      }
    }
    var obj = new Ninja();
    obj.feint();
    console.log(obj.getCount());

  </script>
</body>

</html>


